package com.baidu.location;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

final class q
{
  public int a = 0;
  private boolean c = false;
  private String d = "";
  private boolean e = false;
  private String f = "";
  private int g = 0;
  private int h = 0;
  private String i = "";
  private boolean j = false;
  private String k = "";
  private char l = 'N';
  private String m = "";
  private boolean n = false;
  private int o = 1;
  private double p = 0.0D;
  private double q = 0.0D;
  private List r = null;
  private boolean s = false;
  private List t = null;
  private int u = 0;

  private q(n paramn, List paramList, String paramString1, String paramString2, String paramString3)
  {
    this.r = paramList;
    this.d = paramString1;
    this.i = paramString2;
    this.m = paramString3;
    this.t = new ArrayList();
    a();
  }

  private void a()
  {
    int i1;
    int i2;
    int i3;
    Object localObject1;
    int i7 = 1;
    if (a(this.d))
    {
      localObject1 = this.d.split(",");
      if (localObject1.length == 15);
    }
    do
    {
      return;
      if ((!(localObject1[6].equals(""))) && (!(localObject1[7].equals(""))))
      {
        this.g = Integer.valueOf(localObject1[6]).intValue();
        this.h = Integer.valueOf(localObject1[7]).intValue();
        this.e = true;
      }
      if (!(a(this.m)))
        break label297;
      localObject1 = this.m.substring(0, this.m.length() - 3);
      i1 = 0;
      for (i2 = 0; i1 < ((String)localObject1).length(); i2 = i3)
      {
        i3 = i2;
        if (((String)localObject1).charAt(i1) == ',')
          i3 = i2 + 1;
        i1 += 1;
      }
      localObject1 = ((String)localObject1).split(",", i2 + 1);
    }
    while (localObject1.length < 6);
    if ((!(localObject1[2].equals(""))) && (!(localObject1[(localObject1.length - 3)].equals(""))) && (!(localObject1[(localObject1.length - 2)].equals(""))) && (!(localObject1[(localObject1.length - 1)].equals(""))))
    {
      this.o = Integer.valueOf(localObject1[2]).intValue();
      this.p = Double.valueOf(localObject1[(localObject1.length - 3)]).doubleValue();
      this.q = Double.valueOf(localObject1[(localObject1.length - 2)]).doubleValue();
      this.n = true;
    }
    if ((this.r != null) && (this.r.size() > 0))
    {
      label297: int i4;
      int i5;
      Object localObject2;
      localObject1 = this.r.iterator();
      do
      {
        if (!(((Iterator)localObject1).hasNext()))
          break label641;
        localObject2 = (String)((Iterator)localObject1).next();
        if (!(a((String)localObject2)))
          break label636;
        localObject2 = ((String)localObject2).substring(0, ((String)localObject2).length() - 3);
        i1 = 0;
        for (i2 = 0; i1 < ((String)localObject2).length(); i2 = i3)
        {
          i3 = i2;
          if (((String)localObject2).charAt(i1) == ',')
            i3 = i2 + 1;
          i1 += 1;
        }
        localObject2 = ((String)localObject2).split(",", i2 + 1);
        if ((Integer.valueOf(localObject2[1]).intValue() != this.r.size()) || (localObject2.length <= 8))
          break label614;
        i6 = 1;
        this.s = i6;
        if (!(this.s))
          break label641;
        i1 = 4;
      }
      while (i1 >= localObject2.length);
      if ((!(localObject2[i1].equals(""))) && (!(localObject2[(i1 + 1)].equals(""))) && (!(localObject2[(i1 + 2)].equals(""))))
      {
        this.u += 1;
        i3 = Integer.valueOf(localObject2[i1]).intValue();
        i4 = Integer.valueOf(localObject2[(i1 + 1)]).intValue();
        i5 = Integer.valueOf(localObject2[(i1 + 2)]).intValue();
        if (!(localObject2[(i1 + 3)].equals("")))
          break label620;
      }
      label614: label620: for (i2 = 0; ; i2 = Integer.valueOf(localObject2[(i1 + 3)]).intValue())
        while (true)
        {
          while (true)
          {
            this.t.add(new r(this, i3, i5, i4, i2));
            i1 += 4;
          }
          i6 = 0;
        }
      label636: this.s = false;
      label641: if ((!(this.e)) || (!(this.n)))
        break label674;
    }
    label674: for (int i6 = i7; ; i6 = 0)
      while (true)
      {
        this.c = i6;
        return;
        this.s = false;
      }
  }

  private static boolean a(String paramString)
  {
    int i4 = 0;
    int i3 = i4;
    if (paramString != null)
    {
      i3 = i4;
      if (paramString.length() > 8)
      {
        int i1 = 1;
        int i2 = 0;
        while (i1 < paramString.length() - 3)
        {
          i2 ^= paramString.charAt(i1);
          i1 += 1;
        }
        i3 = i4;
        if (Integer.toHexString(i2).equalsIgnoreCase(paramString.substring(paramString.length() - 2, paramString.length())))
          i3 = 1;
      }
    }
    return i3;
  }

  private static double[] a(double paramDouble1, double paramDouble2)
  {
    return new double[] { Math.sin(Math.toRadians(paramDouble2)) * paramDouble1, Math.cos(Math.toRadians(paramDouble2)) * paramDouble1 };
  }

  private static double[] a(List paramList)
  {
    if ((paramList != null) && (paramList.size() > 0))
    {
      double[] arrayOfDouble1 = a(90 - ((r)paramList.get(0)).b(), ((r)paramList.get(0)).a());
      if (paramList.size() > 1)
      {
        int i1 = 1;
        while (i1 < paramList.size())
        {
          double[] arrayOfDouble2 = a(90 - ((r)paramList.get(i1)).b(), ((r)paramList.get(i1)).a());
          arrayOfDouble1[0] += arrayOfDouble2[0];
          arrayOfDouble1[1] += arrayOfDouble2[1];
          i1 += 1;
        }
        arrayOfDouble1[0] /= paramList.size();
        arrayOfDouble1[1] /= paramList.size();
      }
      return arrayOfDouble1;
    }
    return null;
  }
}